import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        String name = "李卓优"; // 将xxx替换为你的姓名
        System.out.println("你好！我是" + name);
        Scanner scanner = new Scanner(System.in);

        // 获取用户输入
        System.out.print("请输入下限: ");
        int lower = scanner.nextInt();
        System.out.print("请输入上限: ");
        int upper = scanner.nextInt();

        // 存储素数
        ArrayList<Integer> primes = new ArrayList<>();
        for (int i = lower; i <= upper; i++) {
            if (isPrime(i)) {
                primes.add(i);
            }
        }

        // 输出素数，每行10个
        System.out.println("在" + lower + "和" + upper + "之间的素数有：");
        for (int i = 0; i < primes.size(); i++) {
            System.out.print(primes.get(i) + " ");
            if ((i + 1) % 10 == 0) {
                System.out.println(); // 每10个换行
            }
        }
        System.out.println(); // 最后换行

        scanner.close();
    }
    public static boolean isPrime(int num) {
        if (num <= 1) return false;
        if (num == 2) return true;
        if (num % 2 == 0) return false;
        for (int i = 3; i * i <= num; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}